The Anchor
object is an indexed array, containing information about all the anchors in the current document. An Anchor is defined from any present <A NAME="...">
constructs. Text that is both a link and an anchor (i.e. using <A HREF="..." NAME="...">
should have an entry in both the anchors and links array, but only Netscape fully supports this. Internet Explorer only creates an anchor array entry for specific anchors (i.e. using the <A NAME="...">
construct). It treats text that is both a link and an anchor (i.e. using the <A HREF="..." NAME="...">
construct) as a link only, with no anchors array entry being created for it.
Properties | Methods | Events |
length, name** | None | None |
Anchor Properties
length
The length
property can be used to determine the number of anchors in the document. (Bear in mind the subtle differences between Netscape and Internet Explorer when acting on the number of anchors in a document.)
vAnchors=document.anchors.length
name
The name
property stores the name of each anchor (as set in the <A NAME="...">
portion of any anchor text, or anchor/link text). It is accessed by referring to the anchors index in the anchors array.
vName=document.anchors(2).name
would return the name of the documents third anchor as the value of the variable vName
.NOTE : The name
property is Internet Explorer specific.
Anchor Methods
The Anchor Object has no methods.
Anchor Events
The Anchor Object has no events.